﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Base;
using Models;
using ViewModel;

namespace meifengrenchefenlixitongUI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = new MainWindowViewModel();
        }

        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DragMove();
        }

        private void WindowMin_Click(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }

        private void WindowMax_Click(object sender, RoutedEventArgs e)
        {
            if (this.WindowState == WindowState.Normal)
            {
                this.WindowState = WindowState.Maximized;
            }
            else
            {
                this.WindowState = WindowState.Normal;
            }

        }

        private void WindowClose_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("确定退出系统吗？", "退出提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
            if (result == MessageBoxResult.Yes)
            {
                Application.Current.Shutdown();
            }
        }

        private void btn_Entant1_Click(object sender, RoutedEventArgs e)
        {
            DoubleAnimation doubleAnimation = new DoubleAnimation();
            doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));

            TranslateTransform transform = new TranslateTransform();
            img_1.RenderTransform = transform;
            transform.X = 0;
            doubleAnimation.To = 300;
            transform.BeginAnimation(TranslateTransform.XProperty, doubleAnimation);
        }

        private void btn_Entant2_Click(object sender, RoutedEventArgs e)
        {
            DoubleAnimation doubleAnimation = new DoubleAnimation();
            doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));

            TranslateTransform transform = new TranslateTransform();
            img_2.RenderTransform = transform;
            transform.X = 0;
            doubleAnimation.To = 800;
            transform.BeginAnimation(TranslateTransform.XProperty, doubleAnimation);
        }

        private void btn_Entant3_Click(object sender, RoutedEventArgs e)
        {
            DoubleAnimation doubleAnimation = new DoubleAnimation();
            doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));

            TranslateTransform transform = new TranslateTransform();
            img_3.RenderTransform = transform;
            transform.X = 0;
            doubleAnimation.To = 1300;
            transform.BeginAnimation(TranslateTransform.XProperty, doubleAnimation);
        }
    }
}